function check_null(){//表单提交项是否为空的检查
    var username_var = document.getElementById('username')
    var password_var = document.getElementById('password')
    var password_check_var = document.getElementById('password_check')
    var RadioGroup1_var = document.getElementsByName('RadioGroup1')
    var radios_value = "";  //判断radio button组件选择项
    for(var i=0;i<RadioGroup1_var.length;i++){
        if(RadioGroup1_var[i].checked === true){
            radios_value = RadioGroup1_var[i].value;
        }
    }//判断处于同一个radio button组中的项，哪一个被选中
    var province_var = document.getElementById('province')
    var email_var = document.getElementById('Email')
    var intro_var = document.getElementById('intro')
    var password_reg = /^[\w]{6,16}$/                                   //正则表达式判断
    var username_reg = /^[0-9a-zA-Z][0-9a-zA-Z.\-_]{3,18}[0-9a-zA-Z]$/  //正则表达式判断
    var email_reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/                   //正则表达式判断
    var alert_txt = ""; //警告信息汇总
    if (username_var.value === "" || username_var.value == null){
        alert_txt+="请填写用户名 ";
    }
    if (password_var.value === "" || password_var.value == null){
        alert_txt+="请填写密码 ";
    }
    if (password_check_var.value === "" || password_check_var.value == null){
        alert_txt+="请填写确认密码 ";
    }
    if (radios_value === "" || radios_value == null){
        alert_txt+="请选择性别 ";
    }
    if (province_var.value === "" || province_var.value == null){
        alert_txt+="请选择省份 ";
    }
    if (email_var.value === "" || email_var.value == null){
        alert_txt+="请填写邮箱地址 ";
    }
    if (intro_var.value === "" || intro_var.value == null){
        alert_txt+="请填写自我介绍 ";
    }
    if (alert_txt !==""){
        alert(alert_txt);
        return 1;
    }
    return 0;
}
function check(){   //合法性检查
    var username_var = document.getElementById('username')
    var password_var = document.getElementById('password')
    var password_check_var = document.getElementById('password_check')
    var RadioGroup1_var = document.getElementsByName('RadioGroup1')
    var radios_value = "";
    for(var i=0;i<RadioGroup1_var.length;i++){
        if(RadioGroup1_var[i].checked === true){
            radios_value = RadioGroup1_var[i].value;
        }
    }
    var province_var = document.getElementById('province')
    var email_var = document.getElementById('Email')
    var intro_var = document.getElementById('intro')
    var password_reg = /^[\w]{6,16}$/                                   //正则表达式判断
    var username_reg = /^[0-9a-zA-Z][0-9a-zA-Z.\-_]{3,18}[0-9a-zA-Z]$/  //正则表达式判断
    var email_reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/                   //正则表达式判断
    if(!(password_var.value.match(password_reg)))
    {
        alert("密码不合法");
        return 1;
    }
    if(!(username_var.value.match(username_reg)))
    {
        alert("用户名不合法");
        return 1;
    }
    if(!(email_var.value.match(email_reg)))
    {
        alert("邮箱输入不合法");
        return 1;
    }
    if(!(password_check_var.value===password_var.value)){
        alert("两次密码输入不一致，请重新输入");
        return 1;
    }
    return 0;
}
function submitfunc(){//表单提交合法性综合判断
    var flag1 = check_null();
    if (flag1===1){
        return;
    }
    var flag2 = check();
    if (flag1===0 && flag2===0){
        alert("恭喜！提交成功")
    }



}
// function resetfunc(){
//     username_var.value=null;
//     password_var.value = null;
//     password_check_var.value=null;
//     RadioGroup1_var.value = null;
//     radios_value=null;
//     province_var.value = null;
//     email_var.value=null;
//     intro_var.value = null;
//
//
// }